package com.jintoufs.dao.sys.impl;

import com.jintoufs.dao.MyBatisSupport;
import com.jintoufs.dao.QueryFilters;
import com.jintoufs.dao.sys.LogDAO;
import com.jintoufs.domain.sys.Log;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 系统日志
 */
@Repository
public class LogDAOImpl extends MyBatisSupport<LogDAO, Log> implements LogDAO {
    @SuppressWarnings("serial")
    private static Map<String, Object> fildMap = new HashMap<String, Object>() {
        {
            put("id", "id");
            put("createBy", "create_by");
            put("createTime", "create_time");
            put("requestIp", "request_ip");
            put("exceptionCode", "exception_code");
            put("exceptionDetail", "exception_detail");
            put("description", "description");
        }
    };

    @Override
    public void insert(Log log) {
        getMapper().insert(log);
    }

    @Override
    public List<Log> getByFilter(QueryFilters filters_) {
        filters_.format(fildMap);
        return getMapper().getByFilter(filters_);
    }
}
